package com.jprocms.module.cms.api.dto;


import com.jpro.framework.common.enums.CommonStatusEnum;
import com.jprocms.module.cms.enums.EnumWaterMarkType;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.Valid;
import java.io.Serializable;

/**
 * @author jprocms
 */
@AllArgsConstructor
@NoArgsConstructor
@Data
@Schema(description = "管理后台 - 站点配置 Request VO")
public class SiteConfigDto implements Serializable {

    private static final long serialVersionUID = 1L;

    @Schema(description = "站点id")
    private Long id;

    @Schema(description = "站点基本配置")
    @Valid
    private SiteConfigBaseDto base;

    @Schema(description = "水印配置")
    @Valid
    private SiteConfigWatermarkDto watermark;

    @Schema(description = "静态页配置")
    @Valid
    private SiteConfigStaticPageDto staticPage;

    @Schema(description = "评论配置")
    @Valid
    private SiteConfigCommentDto comment;

    @Schema(description = "留言配置")
    @Valid
    private SiteConfigGuestbookDto guestbook = new SiteConfigGuestbookDto();

    public void init() {
        base = new SiteConfigBaseDto();
        base.setAllowPush(false);
        base.setGreyOpen(false);
        base.setPushNeedCheck(true);
        base.setEditPublishContentToSubmit(false);
        base.setTitleRepeat(false);
        watermark = new SiteConfigWatermarkDto();
        watermark.setWatermarkSet(EnumWaterMarkType.NOTHING.getType());
        staticPage = new SiteConfigStaticPageDto();
        staticPage.setOpenSiteStaticPage(false);
        staticPage.setOpenAuto(false);
        staticPage.setListMaxPageSize(100);
        comment = new SiteConfigCommentDto();
        comment.setCommentAudit(true);
        comment.setCommentStatus(CommonStatusEnum.DISABLE.getStatus());
        comment.setCommentInterval(15);
        guestbook = new SiteConfigGuestbookDto();
        guestbook.setIsOpen(false);
        guestbook.setNeedLogin(true);
    }

}
